using System;
using System.Collections.Generic;
using System.Text;

namespace AspAlliance.SimpleCms
{
    class CmsConfigException : ApplicationException
    {
        private CmsErrorMessage _errorMessage = new CmsErrorMessage(); 
        private Exception _exception; 
        private ExceptionType _exceptionType;

        public override string Message
        {
            get
            {
                if (_exceptionType == ExceptionType.Base)
                {
                    return _exception.Message.ToString();
                }

                return _errorMessage[this._exceptionType].ToString();
            }
        }

        public Exception ExceptionObject
        {
            get
            {
                return this._exception;
            }
            set
            {
                this._exception = value;
            }
        }

        public ExceptionType CmsExceptionType
        {
            get
            {
                return this._exceptionType;
            }
            set
            {
                this._exceptionType = value;
            }
        }

        public CmsConfigException(){

        }

        public CmsConfigException(Exception exception, ExceptionType errorType)
        {
            this._exception = exception; this._exceptionType= errorType;
        }

    }
}
